#ifndef TREEPRINTER_H_
#define TREEPRINTER_H_

#include <iostream>
#include <fstream>
#include "../BTree/BTree.h"
#include "../BloqArch/INodo.h"

class BTree;	// Forward declaration

class TreePrinter {
private:
	BTree& _arbol;

	void preOrden(std::ostream& out, INodo& n, int altura, int posicion) const;
	std::string getSangria(int altura) const;

	std::ostream& abrirOutStream(std::string nomArch, std::ofstream& fout) const;
	void cerrarOutStream(std::ofstream& fout) const;

public:
	TreePrinter(BTree& arbol);
	virtual ~TreePrinter();

	void ImprimirEnPreOrden(std::string nomArch = "") const;
	void ImprimirDatos(std::string nomArch = "") const;
};

#endif /* TREEPRINTER_H_ */
